import requests
import base64
import re #正则匹配模块
s = requests.session() #建立会话
url = "http://114.67.246.176:12056/"
head = s.get(url).headers #获取头部信息
print(head)
result = head['flag'] #得到flag的value
result = base64.b64decode(result).decode('utf-8') #第一次base64解码
print(result)
result = re.search('\w+$', result).group(0) #正则匹配base64编码的flag

result = base64.b64decode(result).decode('utf-8') #第二次解码

payload = {'margin': result}

print(s.post(url, data=payload).text) #post传输数据且输出返回信息





